#include <stdint.h>
#include <stdlib.h>

#include <iostream>
#include <string>

namespace xoxyy {
class Date {
 private:
  int64_t year;
  int64_t month;
  int64_t day;
  std::string str;

 public:
  explicit Date(int64_t year, int64_t month, int64_t day);
  std::string String();
  operator char const*();
};
};

int main(int argc, char const* argv[]) {
  xoxyy::Date date = xoxyy::Date::Date(2018, 9, 14);
  std::cout << date.String() << std::endl;
  std::cout << date << std::endl;

  std::cout << "----------------" << std::endl;

  std::string str(date);
  std::cout << str << std::endl;
  str = xoxyy::Date::Date(2018, 9, 15);
  std::cout << str << std::endl;

  return EXIT_SUCCESS;
}

xoxyy::Date::Date(int64_t year, int64_t month, int64_t day)
    : year(year), month(month), day(day) {}

std::string xoxyy::Date::String() {
  return std::to_string(this->year) + "-" + std::to_string(this->month) + "-" +
         std::to_string(this->day);
}

xoxyy::Date::operator char const*() {
  this->str = this->String();
  return this->str.c_str();
}
